package com.cloud.code.牛客网;


import java.util.Scanner;

/**
 * 回文数
 */
public class Test60 {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {

            String line = scanner.nextLine();

            int max = Integer.MIN_VALUE;

            for (int i = 0; i < line.length(); i++) {
                for (int j = line.length(); j > i; j--) {
                    String s = line.substring(i, j);
                    if (isMatch(s)) {
                        max = Math.max(max, s.length());
                    }
                }
            }
            System.out.println(max);

        }
    }

    private static boolean isMatch(String s) {
        return s.equals(new StringBuffer(s).reverse().toString());
    }

}
